<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<title>汽车4S店管理系统登录</title>
<link rel="icon"  href="/images/favicon.ico" type="/images/ico">
<link href="/css/bootstrap.min.css" rel="stylesheet">
<link href="/css/materialdesignicons.min.css" rel="stylesheet">
<link href="/css/style.min.css" rel="stylesheet">
<link href="/css/validate.css" rel="stylesheet">


</head>
<script>
  function send(i) {
    if (i === 0) {
      $("#userform").attr("action", $("#bt0").attr("uri")).submit();
      return false;
    } else if (i === 1) {
      $("#userform").attr("action", $("#bt1").attr("uri")).submit();
      return false;
    }
  }
</script>

  
<body>
<div class="row no-gutters bg-white vh-100">
  <div class="col-md-6 col-lg-7 col-xl-8 d-none d-md-block" style="background-image: url(/images/login-bg-1.jpg); background-size: cover;">

    <div class="d-flex vh-100">
      <div class="p-5 align-self-end">

        <br><br><br>
        <p class="text-white">@AUTHOR BY 2018131918萧锡豪，前端基于Bootstrap v4.4.1。</p>
      </div>
    </div>

  </div>

  <div class="col-md-6 col-lg-5 col-xl-4 align-self-center">
    <div class="p-5">
      <div class="text-center">
        <a href="/login"> <img alt="light year admin" src="/images/logo.png"> </a>
      </div>
      <p class="text-center text-muted"><small>请使用您的账号登录系统</small></p>



      <form method="post" id="userform">
        <div class="form-group">
          <label for="username">用户名</label>
          <input type="text" class="form-control" id="username" name="username" placeholder="请输入您的用户名" >
        </div>

        <div class="form-group">
          <label for="password">密码</label>
          <input type="password" class="form-control" id="password" name="password" placeholder="请输入您的密码" >
        </div>

        <input type="hidden" class="form-control" id="user" name="user">

        <div class="form-group">
          <button class="btn btn-block btn btn btn-info"  th:attr="uri=@{/emplogin.action}" onclick="send(0)"  id="bt0">员工登录</button>
        </div>
        <div class="form-group">
          <button class="btn btn-block btn-primary"  th:attr="uri=@{/login.action}" onclick="send(1)"  id="bt1">管理员登录</button>
        </div>
        <!--提示框-->
        <div class="alert alert-danger" role="alert" th:if="${msg!=null}">
          <div th:text="${msg}"></div>
        </div>
      </form>
      <p class="text-center text-muted mt-3">@ 4S店管家 汽车4S店管理系统</p>
    </div>
  </div>
</div>

<script type="text/javascript" src="/js/jquery.min.js" th:src="@{/js/jquery.min.js}"></script>
<script type="text/javascript" src="/js/jquery.validate.js" th:src="@{/js/jquery.validate.js}"></script>
<script type="text/javascript" src="/js/messages_zh.js" th:src="@{/js/messages_zh.js}"></script>
<script>
  function send(i)
  {
    if (i===0)
    {
      $("#userform").attr("action", $("#bt0").attr("uri")).submit();
      return false;
    }
    else if(i===1)
    {
      $("#userform").attr("action",$("#bt1").attr("uri")).submit();
      return false;
    }

  }


  $().ready(function() {
    $("#userform").validate(
            {
              rules: {
                username: "required",
                password: "required",

              },
              messages:{
                username:"请输入用户名",
                password: "请输入密码",

              },

              errorElement: "em"

            }
    );
  });


</script>

</body>
</html>